import Vue from 'vue'
import Router from 'vue-router'
import system from './system'
import race from './race'
import employee from './employee'
import authorize from './authorize'
import order from './order'
import message from './message'
import sponsor from './sponsor'
import service from './service'
import drafts from './drafts'
import training from './training'
import merchants from './merchants'
import tickets from './tickets'

// jokal新建组件
import organize from './organize'
Vue.use(Router)
let routes = []
routes = routes.concat(system)
routes = routes.concat(organize)

let modulesRoutes = []
modulesRoutes = modulesRoutes.concat(race)
modulesRoutes = modulesRoutes.concat(employee)
modulesRoutes = modulesRoutes.concat(authorize)
modulesRoutes = modulesRoutes.concat(order)
modulesRoutes = modulesRoutes.concat(message)
modulesRoutes = modulesRoutes.concat(sponsor)
modulesRoutes = modulesRoutes.concat(service)
modulesRoutes = modulesRoutes.concat(drafts)
modulesRoutes = modulesRoutes.concat(training)
modulesRoutes = modulesRoutes.concat(merchants)
modulesRoutes = modulesRoutes.concat(tickets)

export default new Router({
  routes: routes.concat([
    {
      path: '/',
      name: 'index',
      component: resolve => require(['modules/index'], resolve),
      children: modulesRoutes
    }
  ])
})
